#include "stdafx.h"
#include "ChartMultiData.h"


CChartMultiData::CChartMultiData()
{
	S = 0;
	E = 0;
	for (int i = 0; i < MaxData; i++)
	{
		Date[i] = 0;
		Time[i] = 0;
		High[i] = 0;
		Low[i] = 0;
		Close[i] = 0;
		Open[i] = 0;
		Volume[i] = 0;
	}
}


CChartMultiData::~CChartMultiData()
{
	
}

void CChartMultiData::AddData(mulData& a_NewData)
{
	if (E == MaxData)
		return;

	
	E++;
}

void CChartMultiData::AddData(long a_Date, long a_Time, double a_High, double a_Low, double a_Open, double a_Close, long a_Volume)
{
	if (E == MaxData)
		return;
	Date[E] = a_Date;
	Time[E] = a_Time;
	High[E] = a_High;
	Low[E] = a_Low;
	Open[E] = a_Open;
	Close[E] = a_Close;
	Volume[E] = a_Volume;

	E++;
}

void CChartMultiData::AddData(long a_Date, long a_Time, double a_CurVal)
{
	if (E == MaxData)
		return;
	Date[E] = a_Date;
	Time[E] = a_Time;
	High[E] = a_CurVal;
	Low[E] = a_CurVal;
	Open[E] = a_CurVal;
	Close[E] = a_CurVal;
	E++;
}

mulData CChartMultiData::GetLastData()
{
	mulData data;
	if (E == 0)
		return data;

	

	return data;
}

mulData CChartMultiData::GetFirstData()
{
	mulData data;

	
	return data;
}

mulData CChartMultiData::GetData(int a_Index)
{
	mulData data;

	if (a_Index < S || a_Index > E - 1)
		return data;

	

	return data;
}

double* CChartMultiData::GetDataArray(int a_Index)
{
	int i = 0;
	double* data = NULL;
	
	return data;
}

void CChartMultiData::UpdateLastData(mulData& a_NewData)
{
	mulData data;
	if (E == 0)
		return;
}

void CChartMultiData::UpdateLastData(double a_High, double a_Low, double a_Close, long a_Volume)
{
	if (a_High > High[E - 1])
		High[E - 1] = a_High;
	if (a_Low < Low[E - 1])
		Low[E - 1] = a_Low;
	Close[E - 1] = a_Close;
	Volume[E - 1] += a_Volume;
}

void CChartMultiData::UpdateData(double a_CurVal)
{
	if (a_CurVal > High[E - 1])
		High[E - 1] = a_CurVal;
	if (a_CurVal < Low[E - 1])
		Low[E - 1] = a_CurVal;
	Close[E - 1] = a_CurVal;
}
